import config from '@/config'
import RequestBase from '@/utils/request.js'

const baseRequest = new RequestBase(config.safetyUrl)

/**
 * 隐患排查_上报隐患
 */
export function report(data) {
  return baseRequest.post('/business/app/hidden-danger/manage/hdpTask/report', data)
}

/**
 * 上报管控排查隐患
 */
export function reportCheck(data) {
  return baseRequest.post('/business/app/check-plan-task/report', data)
}

/**
 * 查询重大隐患类型
 */
export function getMajorHiddenDangerType() {
  return baseRequest.get('/business/app/hidden-danger/manage/majorHiddenDangerType-list')
}

/**
 * 查询转办部门列表
 */
export function getTransferDepartment(transferType) {
  return baseRequest.get(`/mobile/dbd/hidden-danger-report/transfer/department?transferType=${transferType}`)
}

/**
 * 查询转办人员列表
 */
export function getTransferUser(deptId, transferType) {
  return baseRequest.get(
    `/mobile/dbd/hidden-danger-report/transfer/people?deptId=${deptId}&transferType=${transferType}`
  )
}

/**
 * 上报隐患
 */
export function reportToLeader(req) {
  return baseRequest.post(`/business/app/hidden-danger/manage/transfer-report/`, req)
}

/**
 * 派发任务
 */
export function distributeTask(req) {
  return baseRequest.post(`/business/app/hidden-danger/manage/custom-report-dispatch`, req)
}
